import client.Login.*;
import junit.framework.TestCase;
import java.io.IOException;

import com.google.gdata.client.GoogleService;
import com.google.gdata.util.AuthenticationException;

public class LoginTest extends TestCase
{
    public LoginTest( String name ) {
        super( name );
    }

    private String user    = "mrd.test.tube@gmail.com";
    private String pass    = "testing123";
    private String fake    = "faking123";

    private GoogleService gs;
    private Login loggy;

    protected void setUp() throws IOException {
        gs    = new GoogleService("blogger", "testing");
        loggy = new Login();
    }

    public void testSetValidCredentials() throws AuthenticationException {
            loggy.login(gs, user, pass);
    }

    public void testSetFakeCredentials() {
        try {
            loggy.login( gs, user, fake );
            fail( "Expected to fail with invalid login" );
        }
        catch ( AuthenticationException ae ) {
            // passes the test
        }
    }

    protected void tearDown() { 
        gs = null; 
        loggy = null;
    }
}

